import { YsRouteRecord } from "@ys-lib/vue";
import Index from "../../components/layout/LayoutIndex.vue";
import Home from "../../components/pages/HomePage.vue";

import TSInstanceExample from "../../components/pages/ts/InstanceExample.vue";

import VueMQWebSocket from "../../components/pages/vue/MQWebSocket.vue";

import NaiveUIIconExample from "../../components/pages/naive-ui/iconExample.vue";

export function useAppRouterName() {
  return {
    app: "app",
    home: "home",
    tsInstance: "tsInstance",
    vueMQWebSocket: "vueMQWebSocket",
    naiveUIIcon: "naiveUIIcon",
  };
}

export function useAppRouter() {
  const name = useAppRouterName();

  const cfgApp = new YsRouteRecord({
    path: "/",
    name: name.app,
    component: Index,
    meta: {
      useTab: true,
    },
  });

  const cfgHome = new YsRouteRecord({
    path: "",
    name: name.home,
    component: Home,
  });
  cfgApp.addChildren(cfgHome);

  const cfgTSInstance = new YsRouteRecord({
    path: "ts/instance",
    name: name.tsInstance,
    component: TSInstanceExample,
  });
  cfgApp.addChildren(cfgTSInstance);

  const cfgVueMQWebSocket = new YsRouteRecord({
    path: "vue/vue-mq-web-socket",
    name: name.vueMQWebSocket,
    component: VueMQWebSocket,
  });
  cfgApp.addChildren(cfgVueMQWebSocket);

  const cfgNaiveUIIcon = new YsRouteRecord({
    path: "naive-ui/icon",
    name: name.naiveUIIcon,
    component: NaiveUIIconExample,
  });
  cfgApp.addChildren(cfgNaiveUIIcon);

  return cfgApp;
}
